/*
 * SurfaceFactory.cpp
 *
 *  Created on: 03/12/2009
 *      Author: marcos
 */

#include "SurfaceFactory.h"

namespace gui{

SurfaceFactory::SurfaceFactory(int bpp, Uint32 rMask, Uint32 gMask, Uint32 bMask, Uint32 aMask) {
	this->bpp = bpp;
	this->maskColor.red = rMask; //  = { 0, 0, 0 }; // rMask, gMask, bMask
	this->maskColor.green = gMask; //  = { 0, 0, 0 }; // rMask, gMask, bMask
	this->maskColor.blue = bMask; //  = { 0, 0, 0 }; // rMask, gMask, bMask
	this->aMask = aMask;
}

SurfaceFactory::~SurfaceFactory() { }

Surface* SurfaceFactory::createSurface(Portion portion){
	return new Surface(portion, this->bpp, this->maskColor, this->aMask);
}
Surface* SurfaceFactory::createSurface(Portion portion, RGBColor baseColor){
	Surface* surface = this->createSurface(portion);
	surface->fillSurface(baseColor);
	return surface;
}
Surface* SurfaceFactory::createSurface(Surface* surface){
	return new Surface(surface);
}
Surface* SurfaceFactory::createSurface(std::string filename, Portion portion){

	return new Surface(this->imageCache.getImage(filename), portion);
}

}
